mod spaceship;
mod particle;
mod particle_system;

use ggez::{Context, GameResult, GameError, graphics};
use spaceship::Spaceship;


pub struct State{
    spaceship: Spaceship,
}

impl State{
    pub fn new() -> State {
        let spaceship = Spaceship::new();
        State{spaceship}
    }
}

impl ggez::event::EventHandler<GameError> for State {
    fn update(&mut self, ctx: &mut Context) -> GameResult {
        self.spaceship.update(ctx);
        Ok(())
    }
    fn draw(&mut self, ctx: &mut Context) -> GameResult {
        let mut canvas = graphics::Canvas::from_frame(ctx, graphics::Color::WHITE);

        self.spaceship.display(ctx, &mut canvas);

        canvas.finish(ctx)?;
        Ok(())
    }
}